home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gtk+.idb / usr / freeware / include / gdk / gdkprivate.h.z / gdkprivate.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  8.0 KB  |  329 lines

  1. /* GDK - The GIMP Drawing Kit
  2.  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Library General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  12.  * Library General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Library General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __GDK_PRIVATE_H__
  28. #define __GDK_PRIVATE_H__
  29.  
  30.  
  31. #include <X11/Xlib.h>
  32. #include <X11/Xutil.h>
  33. #include <gdk/gdktypes.h>
  34.  
  35. #define gdk_window_lookup(xid)       ((GdkWindow*) gdk_xid_table_lookup (xid))
  36. #define gdk_pixmap_lookup(xid)       ((GdkPixmap*) gdk_xid_table_lookup (xid))
  37. #define gdk_font_lookup(xid)       ((GdkFont*) gdk_xid_table_lookup (xid))
  38.  
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif /* __cplusplus */
  43.  
  44.  
  45. typedef struct _GdkWindowPrivate       GdkWindowPrivate;
  46. typedef struct _GdkWindowPrivate       GdkPixmapPrivate;
  47. typedef struct _GdkImagePrivate           GdkImagePrivate;
  48. typedef struct _GdkGCPrivate           GdkGCPrivate;
  49. typedef struct _GdkColormapPrivate     GdkColormapPrivate;
  50. typedef struct _GdkColorInfo           GdkColorInfo;
  51. typedef struct _GdkVisualPrivate       GdkVisualPrivate;
  52. typedef struct _GdkFontPrivate           GdkFontPrivate;
  53. typedef struct _GdkCursorPrivate       GdkCursorPrivate;
  54. typedef struct _GdkEventFilter           GdkEventFilter;
  55. typedef struct _GdkClientFilter           GdkClientFilter;
  56. typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
  57. typedef struct _GdkRegionPrivate       GdkRegionPrivate;
  58.  
  59.  
  60. struct _GdkWindowPrivate
  61. {
  62.   GdkWindow window;
  63.   GdkWindow *parent;
  64.   Window xwindow;
  65.   Display *xdisplay;
  66.   gint16 x;
  67.   gint16 y;
  68.   guint16 width;
  69.   guint16 height;
  70.   guint8 resize_count;
  71.   guint8 window_type;
  72.   guint ref_count;
  73.   guint destroyed : 2;
  74.   guint mapped : 1;
  75.   guint guffaw_gravity : 1;
  76.  
  77.   gint extension_events;
  78.  
  79.   GList *filters;
  80.   GdkColormap *colormap;
  81.   GList *children;
  82. };
  83.  
  84. struct _GdkImagePrivate
  85. {
  86.   GdkImage image;
  87.   XImage *ximage;
  88.   Display *xdisplay;
  89.   gpointer x_shm_info;
  90.  
  91.   void (*image_put) (GdkDrawable *window,
  92.              GdkGC     *gc,
  93.              GdkImage     *image,
  94.              gint      xsrc,
  95.              gint      ysrc,
  96.              gint      xdest,
  97.              gint      ydest,
  98.              gint      width,
  99.              gint      height);
  100. };
  101.  
  102. struct _GdkGCPrivate
  103. {
  104.   GdkGC gc;
  105.   GC xgc;
  106.   Display *xdisplay;
  107.   guint ref_count;
  108. };
  109.  
  110. typedef enum {
  111.   GDK_COLOR_WRITEABLE = 1 << 0
  112. } GdkColorInfoFlags;
  113.  
  114. struct _GdkColorInfo
  115. {
  116.   GdkColorInfoFlags flags;
  117.   guint ref_count;
  118. };
  119.  
  120. struct _GdkColormapPrivate
  121. {
  122.   GdkColormap colormap;
  123.   Colormap xcolormap;
  124.   Display *xdisplay;
  125.   GdkVisual *visual;
  126.   gint private_val;
  127.  
  128.   GHashTable *hash;
  129.   GdkColorInfo *info;
  130.   time_t last_sync_time;
  131.   
  132.   guint ref_count;
  133. };
  134.  
  135. struct _GdkVisualPrivate
  136. {
  137.   GdkVisual visual;
  138.   Visual *xvisual;
  139. };
  140.  
  141. struct _GdkFontPrivate
  142. {
  143.   GdkFont font;
  144.   /* XFontStruct *xfont; */
  145.   /* generic pointer point to XFontStruct or XFontSet */
  146.   gpointer xfont;
  147.   Display *xdisplay;
  148.   guint ref_count;
  149. };
  150.  
  151. struct _GdkCursorPrivate
  152. {
  153.   GdkCursor cursor;
  154.   Cursor xcursor;
  155.   Display *xdisplay;
  156. };
  157.  
  158. struct _GdkDndCursorInfo {
  159.   Cursor      gdk_cursor_dragdefault, gdk_cursor_dragok;
  160.   GdkWindow     *drag_pm_default, *drag_pm_ok;
  161.   GdkPoint      default_hotspot, ok_hotspot;
  162.   GList *xids;
  163. };
  164. typedef struct _GdkDndCursorInfo GdkDndCursorInfo;
  165.  
  166. struct _GdkDndGlobals {
  167.   GdkAtom         gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest;
  168.   GdkAtom         gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel;
  169.   GdkAtom         gdk_XdeTypelist;
  170.  
  171.   GdkDndCursorInfo  *c;
  172.   GdkWindow    **drag_startwindows;
  173.   guint          drag_numwindows;
  174.   gboolean      drag_really, drag_perhaps, dnd_grabbed;
  175.   Window      dnd_drag_target;
  176.   GdkPoint      drag_dropcoords;
  177.  
  178.   GdkPoint dnd_drag_start, dnd_drag_oldpos;
  179.   GdkRectangle dnd_drag_dropzone;
  180.   GdkWindowPrivate *real_sw;
  181.   Window dnd_drag_curwin;
  182.   Time last_drop_time; /* An incredible hack, sosumi miguel */
  183. };
  184. typedef struct _GdkDndGlobals GdkDndGlobals;
  185.  
  186. struct _GdkEventFilter {
  187.   GdkFilterFunc function;
  188.   gpointer data;
  189. };
  190.  
  191. struct _GdkClientFilter {
  192.   GdkAtom       type;
  193.   GdkFilterFunc function;
  194.   gpointer      data;
  195. };
  196.  
  197. #ifdef USE_XIM
  198.  
  199. typedef struct _GdkICPrivate GdkICPrivate;
  200.  
  201. struct _GdkICPrivate
  202. {
  203.   XIC xic;
  204.   GdkICAttr *attr;
  205.   GdkICAttributesType mask;
  206. };
  207.  
  208. #endif /* USE_XIM */
  209.  
  210. struct _GdkColorContextPrivate
  211. {
  212.   GdkColorContext color_context;
  213.   Display *xdisplay;
  214.   XStandardColormap std_cmap;
  215. };
  216.  
  217. struct _GdkRegionPrivate
  218. {
  219.   GdkRegion region;
  220.   Region xregion;
  221. };
  222.  
  223. typedef enum {
  224.   GDK_DEBUG_MISC          = 1 << 0,
  225.   GDK_DEBUG_EVENTS        = 1 << 1,
  226.   GDK_DEBUG_DND           = 1 << 2,
  227.   GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
  228.   GDK_DEBUG_XIM           = 1 << 4
  229. } GdkDebugFlag;
  230.  
  231. void gdk_events_init (void);
  232. void gdk_window_init (void);
  233. void gdk_visual_init (void);
  234. void gdk_dnd_init    (void);
  235.  
  236. void gdk_image_init  (void);
  237. void gdk_image_exit (void);
  238.  
  239. GdkColormap* gdk_colormap_lookup (Colormap  xcolormap);
  240. GdkVisual*   gdk_visual_lookup     (Visual   *xvisual);
  241.  
  242. void gdk_window_add_colormap_windows (GdkWindow *window);
  243. void gdk_window_destroy_notify         (GdkWindow *window);
  244.  
  245. void     gdk_xid_table_insert (XID    *xid,
  246.                    gpointer     data);
  247. void     gdk_xid_table_remove (XID     xid);
  248. gpointer gdk_xid_table_lookup (XID     xid);
  249.  
  250. gint gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
  251.               XEvent *event_send);
  252.  
  253. /* If you pass x = y = -1, it queries the pointer
  254.    to find out where it currently is.
  255.    If you pass x = y = -2, it does anything necessary
  256.    to know that the drag is ending.
  257. */
  258. void gdk_dnd_display_drag_cursor(gint x,
  259.                  gint y,
  260.                  gboolean drag_ok,
  261.                  gboolean change_made);
  262.  
  263. /* Please see gdkwindow.c for comments on how to use */ 
  264. Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
  265. Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
  266.  
  267. extern gint         gdk_debug_level;
  268. extern gint         gdk_show_events;
  269. extern gint         gdk_use_xshm;
  270. extern gint         gdk_stack_trace;
  271. extern gchar        *gdk_display_name;
  272. extern Display        *gdk_display;
  273. extern gint         gdk_screen;
  274. extern Window         gdk_root_window;
  275. extern Window         gdk_leader_window;
  276. extern GdkWindowPrivate     gdk_root_parent;
  277. extern Atom         gdk_wm_delete_window;
  278. extern Atom         gdk_wm_take_focus;
  279. extern Atom         gdk_wm_protocols;
  280. extern Atom         gdk_wm_window_protocols[];
  281. extern Atom         gdk_selection_property;
  282. extern GdkDndGlobals     gdk_dnd;
  283. extern GdkWindow    *selection_owner[];
  284. extern gchar        *gdk_progclass;
  285. extern gint         gdk_error_code;
  286. extern gint         gdk_error_warnings;
  287. extern gint              gdk_null_window_warnings;
  288. extern GList            *gdk_default_filters;
  289. extern const int         gdk_nevent_masks;
  290. extern const int         gdk_event_mask_table[];
  291.  
  292. extern GdkWindowPrivate *gdk_xgrab_window;  /* Window that currently holds the
  293.                          * x pointer grab
  294.                          */
  295.  
  296. #ifdef USE_XIM
  297. /* XIM support */
  298. gint   gdk_im_open         (void);
  299. void   gdk_im_close         (void);
  300. void   gdk_ic_cleanup         (void);
  301.  
  302. extern GdkICPrivate *gdk_xim_ic;        /* currently using IC */
  303. extern GdkWindow *gdk_xim_window;            /* currently using Window */
  304. #endif /* USE_XIM */
  305.  
  306. /* Debugging support */
  307.  
  308. #ifdef G_ENABLE_DEBUG
  309.  
  310. #define GDK_NOTE(type,action)             G_STMT_START { \
  311.     if (gdk_debug_flags & GDK_DEBUG_##type)            \
  312.        { action; };                 } G_STMT_END
  313.  
  314. #else /* !G_ENABLE_DEBUG */
  315.  
  316. #define GDK_NOTE(type,action)
  317.       
  318. #endif /* G_ENABLE_DEBUG */
  319.  
  320. extern guint gdk_debug_flags;
  321.  
  322.  
  323. #ifdef __cplusplus
  324. }
  325. #endif /* __cplusplus */
  326.  
  327.  
  328. #endif /* __GDK_PRIVATE_H__ */
  329.